<template>
  <section>
    <el-row style="border: 1px solid #cfcfcf">
      <el-row v-for="sum in currAnswer.data.sum" :key="sum.id" style="line-height: 30px">
        <el-row v-if="!sum.childrens" >
          <el-col :span="8">
            <div style="float: right">{{sum.name}}</div>
          </el-col>
          <el-col :span="1" >
            :
          </el-col>
          <el-col :span="2">
            {{sum.point}}
          </el-col>
        </el-row>
        <el-row  v-if="sum.childrens" v-for="c in sum.childrens" :key="c.id">
          <el-col :span="8" ><div style="float: right">{{sum.name}}/{{c.name}}</div>
          </el-col>
          <el-col :span="1">
            :
          </el-col>
          <el-col :span="2">
            {{c.point}}
          </el-col>
        </el-row>
      </el-row>
    </el-row>
    <!--<el-table :data="table" style="width: 100%" border>-->
    <!--<el-table-column type="index" width="50px"></el-table-column>-->
    <!--<el-table-column v-for="tactic in tactics" :key="tactic.id" :label="tactic.name" :prop="''+tactic.id">-->
    <!--<div  v-if="tactic.childrens">-->
    <!--<el-table-column v-for="t in tactic.childrens" :key="t.id" :label="t.name" :prop="''+t.id">-->
    <!--</el-table-column>-->
    <!--</div>-->
    <!--<template slot-scope="scope">-->
    <!--<span v-for="(r,i) in scope.row" :key="r" v-if="i == tactic.id" >{{r}}</span>-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--</el-table>-->
  </section>
</template>

<script>
  import Vue from 'vue'//后续添加属性，需要vue联动
  import {mapGetters, mapActions, mapMutations} from 'vuex'
  export default {
    name: "tacticsTable",
    props:['tactics','currAnswer'],
    data(){
      return{
        open: false,
        table:[],
      }
    },
    computed:{
      isFolder() {
        return this.tactics.childrens && this.tactics.childrens.length
      },
    },
    created(){
      console.log(this.currAnswer)
    },
    methods: {
      ...mapActions({
        fetch: 'fetch'
      }),
      makeUi(sumUi){
        sumUi.forEach(s=>{
          let key = s.id
          table[key]=s.point
          if(s.childrens){
            table = this.makeUi(s.childrens)
            return table
          }
        })
        return table
      }
    }
  }
</script>

<style scoped>

</style>
